package sysu.el.audit;

public class MaxIntDes<T> extends MaxInt{
	public T des = null;
	public MaxIntDes(int init){
		super(init);
	}
	
	public MaxIntDes(){
		this(Integer.MIN_VALUE);
	}
	
	public void reset(){
		this.ans = Integer.MIN_VALUE;
		this.des = null;
	}
	
	public void sample(int sam){ 
		sample(sam, null);
	}
	
	public void sample(int sam, T t){
		if (sam > this.ans){
			this.ans = sam;
			des = t;
		}
	}
	
	public boolean update(int sam, T t){
		if (sam > this.ans){
			this.ans = sam;
			des = t;
			return true;
		}
		return false;
	}
	
	public void sampleLast(int sam, T t){
		if (sam >= this.ans){
			this.ans = sam;
			des = t;
		}
	}

	public int getAns(int sam){
		return getAns(sam, null);
	}
	
	public int getAns(int sam, T t){
		sample(sam, t);
		return this.getAns();
	}
	
	public int getAns(){
		return this.ans;
	}
	
	public T getDes(){
		return this.des;
	}
}
